import axios from 'axios';

let vm = {
	net_login(username, password) {
		return post('/user/login', {
			username,
			passwd: password
		});
	},
	net_sayhello() {
		return get();
	},
	net_reg(username, password) {
		return post('/user/reg', {
			username,
			password
		});
	}
}

function post(path, data) {
	return axios.post(baseURL + path, data).then(res => {
		return res.data;
	});
}

function get(path) {
	return axios.get(baseURL + path).then(res => {
		return res.data;
	});
}

export default vm;